<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>${functionNameSimple}列表</title>
    <script type="text/javascript" src="js/jquery-1.12.4.min.js" th:src="@{/js/jquery-1.12.4.min.js}"></script>
    <link href="bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet" th:href="@{/bootstrap-3.3.7-dist/css/bootstrap.min.css}">
    <script src="bootstrap-3.3.7-dist/js/bootstrap.min.js" th:src="@{/bootstrap-3.3.7-dist/js/bootstrap.min.js}"></script>
    <script type="text/javascript">
        $(function() {
        	
        })

        function page(n){
            $("#pageNo").val(n);
            $("#searchForm").submit();
            return false;
        }
    </script>
</head>

<body>
<div class="container-fluid">
   <br>
    <!--
    <ol class="breadcrumb">
        <li class="active">列表数据</li>
    </ol>-->

    <form id="searchForm" action="/admin/sys/user/list" method="post" class="form-horizontal">
        <input id="pageNo" name="pageNo" type="hidden" value="1"/>
        <div class="form-group">
            <label for="username" class="col-sm-1 control-label">用户名：</label>
            <div class="col-sm-2">
                <input name="username" htmlEscape="false" class="form-control input-sm" placeholder="用户名" th:value="${user.username}"/>
            </div>
            <label for="role" class="col-sm-1 control-label">角色：</label>
            <div class="col-sm-2" >
            	<select  class="form-control input-sm" name="role">
            		<option value="">未选择</option>
            		<option value="2" th:selected="${user.role=='2'}">工作人员</option>
            		<option value="1" th:selected="${user.role=='1'}">管理员</option>
            	</select>
            </div>
            <!-- <label for="isBlock" class="col-sm-1 control-label">是否锁定：</label>
            <div class="col-sm-2">
                <input name="isBlock" htmlEscape="false" class="form-control input-sm" placeholder="是否锁定" th:value="${user.isBlock}"/>
            </div> -->
            <button class="btn btn-success btn-sm" type="submit">
                <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
                查询
            </button>
            <a th:href="@{/admin/sys/user/form}" class="btn btn-info btn-sm" target="mainFrame">新增</a>
        </div>
    </form>
    <table id="contentTable" class="table table-striped table-bordered table-condensed">
        <thead>
        <tr>
            <th>序号</th>
            <th>用户名</th>
            <th>电话</th>
            <th>邮箱</th>
            <th>角色</th>
           <!--  <th>是否锁定</th> -->
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="user,userStat:${pageInfo.list}">
            <td>[[${userStat.index+1}]]</td>
            <td>
                [[${user.username}]]
            </td>
             <td>
                [[${user.tel}]]
            </td>
             <td>
                [[${user.email}]]
            </td>
            <td>
                <span style="color: green" th:if="${user.role=='1'}">超级管理员</span>
                <span style="color: grey" th:if="${user.role=='2'}">普通管理员</span>
            </td>
           <!--  <td>
                <span style="color: green" th:if="${user.isBlock=='1'}">锁定</span>
                <span style="color: grey" th:if="${user.isBlock=='0'}">未锁定</span>
            </td> -->
            <td>
                <a href="/sys/user/form?id=" th:href="@{/admin/sys/user/form?id=}+${user.id}">
                    <button class="btn btn-primary btn-xs" ><span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                        编辑
                    </button>
                </a>
                <a href="/sys/user/delete?id=${user.id}"  th:href="@{/admin/sys/user/delete?id=}+${user.id}" onclick="return confirm('确认要删除吗？', this.href)">
                    <button class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                        删除
                    </button>
                </a>
            </td>
        </tr>
        </c:forEach>
        </tbody>
    </table>


    <div class="row" th:include="model :: pageInfo"></div>

</div>

</body>

</html>